# -*- coding: utf-8 -*-
import web
import auth
from model import db
from web.contrib.template import render_jinja

render = render_jinja(
	 'templates/main', 
	 encoding = 'utf-8',
	)


urls = (
#static index page
	 "/",
	 "index",
	 #auth
	 "/dologin",
	 "auth.dologin",
	 "/dologout",
	 "auth.dologout"

	 
)

app = web.application(urls, globals(), autoreload=True)
store = web.session.DiskStore('sessions')
session = web.session.Session(app, store, initializer={'user': 'anonymous'})
def session_hook():
    web.ctx.session = session
app.add_processor(web.loadhook(session_hook))

class index:
	 def GET(self):
	 	 return render.index()

if __name__ == "__main__":
	 app.run()



